Try to make the marker.rs code a little more idiomatic by moving code from plain functions to impl blocks