Refactor buildActions to support promises and chaining