Deleted debug p tags and fixed more bugs. Code is a little more tidier.