working but worst code ever written|.