finished full program. compiles succesfully, but haven't tested