Small reorganization

Fix some shell injection issues, reorganizing and cleaning up Python