added piston and corrected keyboard events