Added the blocks and correct return value

Also:

- Cleaning of unnecessary code
- Adding copyright comment
- Improved documentation