cleaned up particle code