did some test, cleaned up code