added initial code

code tested and seems to work with examples I found