cleant up the code