Added a lot of stuff. Avouded the memory issue