Fixed various issues, completely working. Still optizing program