Partially reverts commit e91f0c4f8b, simplifying code. Signed-off-by: James Almer <jamrial@gmail.com>
e91f0c4f8b