move and remove unused code