code refactor and add forms