Very hacky function simplification.