Slight bug in implementation