updated readme and working version without any protection for edge cases