functionally complete. need to add error checking