Improved the code style (added constants, documentation, removed old code, etc) as per issue #1.