More cleanup and make sure app type is always lowercase