Added initial verbose mode, cleaned up code