some refactorign and spaceing