Refactoring bugs fixed 4