final code finished. Need to time