Finally works. Initial functioning commit