Used @mattflaschen's example as a test, improved style