Fixed almost all bugs. Added man page. Improved cmake system.