Cleaned code and moved to appropriate package