messy but ready to test