MAJOR refactoring! now it looks much better!