Updated with suggestions from @georgestephanis. Thanks!