Cleaned up standalone.py and moved functionality to their own modules