fixed #78, cleaned up class