fix namespace and refactor controller