fixes #7; made the code "more beautiful"