testing out direct implementation from paper