refactor for readability
add find and type checking