made several enhancements. functionality changed a bit
added function to repo