Cleaned up Code - Working version BETA ver 1.0