Fixed bug with struct & arrays. Cleaned up the code.