Cleaned up some minor bugs and added more configurability.