Tydus' Refine

Several refinement onto the code