optimize server actions and create definitions