Fixed super ugly code

-Still moderately ugly