Refactor API commands a bit