Made improvements, but the code needs a cleanup...