Clean up codes. Add depth limit for directory seeking.