Refactor deprecated functions and files