Merge pull request #553 from Atheros1/master

Some UI code refactoring