updated with more concise implementation comments