Modified for my own usage.