The entire block has been rewritten if you still feel like more comments are needed please let me know