initial commit of stuff came from Mister-KMA 2012