finished library implementation