completed main functionality. Need to change the UI now.