Minor improvements and general cleanup