Restructered for usage as extension