Add secure hash function
refactor code, merge options