Removed unnecessary code. Added tests and lacking code. Debugging.