Completed buffer functionality of lab3