works but needs cleanup...