Added comments, cleaned up code, and allowed configuration from within app