Restructured for use in eclipse and made more OO