working version before component refactor