finish logic and code