Work, refactoring and bug fixing