Fixed issue #1 and improved design
