Condense some code, remove unused file.