Testing, bug fixing and refactoring