use #define_singleton_method and new hash syntax

Tests passed