Rewrite of core class, added alot of documentation, added phpdoc xml