refactor and add beans