Final touches. Tested and works as intended.