refactored mount implementation to get rid of duplicated code