Issue #30: Cleaned up code