Re-wrote the entire thing