Split bit buffer & gpx reader into separate modules.
Add check_file_type function.