make it more error saved and remove unused lines