Cleaned up core functions; added strpos/indexOf