Refactored in create and locate functions.