changed the main handler function to unexported