Actual implementation. Quick and dirty.