Made program more efficient
Fixes, cleaning code