Code Refactoring and finish GUI design