First working, many commented code