added comments and fixed mnist input