Fix for #19

This pull request fixes issue #19. It also contains the commits that are already being pushed on separate requests.