Cleaned up module code