Bugfixing and refactoring. Todo list added.