Code improvements and updated mamertes dependency