Code created by albertcode, feel free to use it.