Refactored tank controller