Complete code overhaul + added RNG