Mind you, most of this does absolutely nothing or could be rewritten in two lines.