Trying to optimize code so the frame doesn't take so long to load...not working very well yet.