Implemented functions from Elyotna's fork