Refactoring bugs fixed 3