Working but not optimal
Minor changes