refactored api for better readability