Re-made changes from e20673d