added a mini swing gui and did some refactoring...