Added example configuration and cleaned up code