Refactor deprecated methods, minor reformatting