Refactor and add pulse annotations