added most functionality.