Fixed Issue #3 and Cleaned Code